class UserMailer < ActionMailer::Base
  def signup_notification(user)
    setup_email(user)
    @subject    += 'Активируйте Ваш новый аккаунт на diaspora.com.ua'
  
    @body[:url]  = "http://diaspora.com.ua/activate/#{user.activation_code}"
  
  end
  
  def activation(user)
    setup_email(user)
    @subject    += 'Ваш аккаунт активирован'
    @body[:url]  = "http://diaspora.com.ua/"
  end
  
  def comments(comment)
  	setup_email(comment.commentable.user)
  	@subject    += 'Новый комментарий'
  	@body[:title] = comment.commentable.title
  	@body[:comment]  = comment.comment_html
  	@body[:post_url] = "http://diaspora.com.ua/users/#{comment.commentable.user.login}/posts/#{comment.commentable.to_param}#comments"
  	@body[:url]  = "http://diaspora.com.ua/"
  end
  
  protected
    def setup_email(user)
      @recipients  = "#{user.email}"
      @from        = "info@diaspora.com.ua"
      @subject     = "[diaspora.com.ua] "
      @sent_on     = Time.now
      @body[:user] = user
    end
end
